import random

class P():
    def __init__(self):
        self.mylist = [round(random.random()*100,3) for i in range(200)]

    def get_t(self):
        t = sum(self.mylist)/len(self.mylist)
        return round(t, 3)
    
    # 计算梯度函数
    def get_variance(self):
        variance_list = []
        for i in range(len(self.mylist)):
            if i == 0:
                variance_list.append(0)
            else:
                variance_list.append(self.mylist[i]-self.mylist[i-1])
        return [round(v, 3) for v in variance_list]

    # 计算均线5与梯度极值点之间的差值
    
p = P()

print(p.get_t())
print(p.get_variance())